/*     */ package com.zimbra.cs.service.formatter;
/*     */ 
/*     */ import java.util.Collections;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class FormatterFactory
/*     */ {
/*     */   public static enum FormatType
/*     */   {
/*  35 */     ATOM("atom"), 
/*  36 */     CONTACT_FOLDER("cf"), 
/*  37 */     CSV("csv"), 
/*  38 */     FREE_BUSY("freebusy"), 
/*  39 */     HTML("html"), 
/*  40 */     HTML_CONVERTED("native"), 
/*  41 */     ICS("ics"), 
/*  42 */     IFB("ifb"), 
/*  43 */     JSON("json"), 
/*  44 */     RSS("rss"), 
/*  45 */     SYNC("sync"), 
/*  46 */     TAR("tar"), 
/*  47 */     TGZ("tgz"), 
/*  48 */     VCF("vcf"), 
/*  49 */     XML("xml"), 
/*  50 */     ZIP("zip"), 
/*  51 */     OPATCH("opatch");
/*     */     
/*     */ 
/*     */ 
/*     */ 
/*  56 */     private static Map<String, FormatType> strToType = Collections.emptyMap();
/*     */     
/*     */ 
/*     */ 
/*     */ 
/*     */     private String strName;
/*     */     
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */     private FormatType(String strName)
/*     */     {
/*  69 */       this.strName = strName;
/*     */     }
/*     */     
/*     */     public String toString()
/*     */     {
/*  74 */       return this.strName;
/*     */     }
/*     */     
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */     public static FormatType fromString(String str)
/*     */     {
/*  84 */       FormatType result = (FormatType)strToType.get(str);
/*     */       
/*     */ 
/*  87 */       if ((result == null) && (strToType.isEmpty())) {
/*  88 */         Map<String, FormatType> tempMap = new HashMap();
/*  89 */         for (FormatType type : values()) {
/*  90 */           tempMap.put(type.toString(), type);
/*  91 */           if (type.toString().equals(str))
/*     */           {
/*  93 */             result = type;
/*     */           }
/*     */         }
/*  96 */         strToType = Collections.unmodifiableMap(tempMap);
/*     */       }
/*     */       
/*  99 */       return result;
/*     */     }
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/* 107 */   public static Map<FormatType, Formatter> mFormatters = new HashMap();
/* 108 */   public static Map<String, Formatter> mDefaultFormatters = new HashMap();
/* 109 */   static { mFormatters = Collections.synchronizedMap(mFormatters);
/* 110 */     mDefaultFormatters = Collections.synchronizedMap(mDefaultFormatters);
/*     */     
/* 112 */     addFormatter(new CsvFormatter());
/* 113 */     addFormatter(new VcfFormatter());
/* 114 */     addFormatter(new IcsFormatter());
/* 115 */     addFormatter(new RssFormatter());
/* 116 */     addFormatter(new AtomFormatter());
/* 117 */     addFormatter(new NativeFormatter());
/* 118 */     addFormatter(new FreeBusyFormatter());
/* 119 */     addFormatter(new IfbFormatter());
/* 120 */     addFormatter(new SyncFormatter());
/* 121 */     addFormatter(new XmlFormatter());
/* 122 */     addFormatter(new JsonFormatter());
/* 123 */     addFormatter(new HtmlFormatter());
/* 124 */     addFormatter(new TarFormatter());
/* 125 */     addFormatter(new TgzFormatter());
/* 126 */     addFormatter(new ZipFormatter());
/* 127 */     addFormatter(new ContactFolderFormatter());
/* 128 */     addFormatter(new OctopusPatchFormatter());
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public static void addFormatter(Formatter formatter)
/*     */   {
/* 138 */     mFormatters.put(formatter.getType(), formatter);
/* 139 */     for (String mimeType : formatter.getDefaultMimeTypes()) {
/* 140 */       mDefaultFormatters.put(mimeType, formatter);
/*     */     }
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/formatter/FormatterFactory.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */